'use strict';
// Copyright 2014 Blueant Inc. All Rights Reserved.

/**
 * @fileoverview 跑马灯
 * @author sundbcn@gmail.com (sun debing)
 */

var dataApi = require('../libs/dataApi');
var _ = require('lodash');

/**
 * 获取跑马灯信息类型配置
 * @param  {[type]} vip [description]
 * @return {[type]}     [description]
 */
exports.getConf = function (msg_type) {
    return dataApi.advert.findById(msg_type);
};

/**
 * 获取跑马灯信息类型对应信息配置
 * @param  {[type]} vip [description]
 * @return {[type]}     [description]
 */
exports.getMsgConf = function (msg_type) {
    var list = [];
    var conf_list = dataApi.advert_config.all();

    _.each(conf_list, function (value) {
        if (value.type == msg_type) {
            list.push(value);
        }
    });
    return list;
};
